package game;

import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.ImageIcon;

public class Spike extends SkinnedPlatform{
	
	private static final long serialVersionUID = 1L;
	
	public Spike(Level g, int x, int y, int w, int h) {
		level = g;
		this.x = x;
		this.y = y;
		width = w;
		height = h;
		try {
			icon = new ImageIcon(ImageIO.read(new File("images/Spikes.png")));
		} catch (IOException e) {
		}
	}
	
	public void topHit(GameRectangle t){
		if(t instanceof Mario){
			((Mario)t).death();
		}
	}
	public void sideHit(GameRectangle l){
		if(l instanceof Mario){
			((Mario)l).death();
		}
	}
	
	public void removeSelfFromGame(){
		level.platforms.remove(this);
	}
}
